package com.dly.hope.repository;

import com.dly.hope.workflow.ProcessInstance;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

/**
 * @Name: ProcessInstanceRepository
 * @Description:
 * @Author: Danny Chen
 * @Date: 2022/1/18
 */
public interface ProcessInstanceRepository extends JpaRepository<ProcessInstance, String> {


//    @Query(value = "select new com.dragonbravo.magicfund.model.vo.ProcessInstanceVO(info.id,info.name,instance.id,instance.sponsorUserId)" +
//            " from ProcessInstance instance" +
//            " left join ProcessInfo info on instance.processId=info.id " +
//            " where instance.id=?1 and instance.dataStatus=?2 and info.dataStatus=?2")
//    ProcessInstanceVO findProcessInstanveVo(String processInstanceId, Integer dataStatus);

    ProcessInstance findTopByIdAndDataStatus(String id, Integer dataStatus);

    Optional<ProcessInstance> getByIdAndDataStatus(String id, Integer dataStatus);

}
